<?php
namespace app\admin\validate;

use think\Validate;

class Admin extends Validate {

    protected $rule = [
        "username" => "require",
        "password" => "require",
        "captcha" => "require|checkCaptcha:captcha_check",
    ];

    protected $message = [
        "username" => "用户名必须不能为空",
        "password" => "密码必须不能为空",
        "captcha" => "验证码必须不能为空",
    ];

    protected function checkCaptcha($value, $rule, $data = []) {

        if (!$rule($value)){
            return "验证码不正确";
        }

        return true;
    }
}